﻿#ifndef _ED_AES_H_
#define _ED_AES_H_

#define FTD_HERAD1    0xA1B2C3D4
#define FTD_HERAD2    0x1A2B3C4D

#define FTD_TAIL1     0xC1D2E3F4
#define FTD_TAIL2     0x1C2D3E4F


#pragma pack(push,1)
typedef struct file_tail_data_s
{
    unsigned int    head1;
    unsigned int    head2;
    unsigned int    file_len;     // 文件总长度
    unsigned int    rest_len;     // 本次数据包有效长度
    unsigned int    sum;          // 文件校验和
    unsigned int    crc;          // CRC
    unsigned int    tail1;
    unsigned int    tail2;
}file_tail_data_t;
#pragma pack(pop)

void set_aes_key(char* key);

unsigned int calc_file_sum(unsigned char* data, int len);

unsigned char aes_encrypt(unsigned char* in_buf, int in_len,unsigned char* out_buf, int* out_len);

unsigned char aes_decrypt(unsigned char* in_buf, int in_len,unsigned char* out_buf, int* out_len);

#endif
